| Conditions | 1 |
| Paths | 1 |
| Total Lines | 53 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | // Karma configuration |
||
| 7 | module.exports = function( config ) { |
||
| 8 | config.set( { |
||
| 9 | frameworks: [ 'jasmine', 'es6-shim' ], |
||
| 10 | reporters: [ 'spec', 'coverage' ], |
||
| 11 | browsers: [ 'PhantomJS' ], |
||
| 12 | colors: true, |
||
| 13 | |||
| 14 | // ... normal karma configuration |
||
| 15 | files: [ |
||
| 16 | 'node_modules/babel-polyfill/dist/polyfill.js', |
||
| 17 | require.resolve( 'jquery' ), |
||
| 18 | 'https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.3/underscore-min.js', |
||
| 19 | 'https://code.jquery.com/ui/1.12.1/jquery-ui.min.js', |
||
| 20 | 'node_modules/Iris/dist/iris.min.js', |
||
| 21 | |||
| 22 | // All files ending in "_test" |
||
| 23 | // { pattern: 'test/*_test.js', watched: false } |
||
| 24 | |||
| 25 | { pattern: 'test/**/*_test.js', watched: false } |
||
| 26 | |||
| 27 | // Each file acts as entry point for the webpack configuration |
||
| 28 | ], |
||
| 29 | |||
| 30 | preprocessors: { |
||
| 31 | |||
| 32 | // Add webpack as preprocessor |
||
| 33 | 'test/*_test.js': [ 'webpack', 'sourcemap' ], |
||
| 34 | 'test/**/*_test.js': [ 'webpack', 'sourcemap' ] |
||
| 35 | }, |
||
| 36 | |||
| 37 | // Optionally, configure the reporter |
||
| 38 | coverageReporter: { |
||
| 39 | type: 'html', |
||
| 40 | dir: 'coverage/', |
||
| 41 | reporters: [ |
||
| 42 | |||
| 43 | // Reporters not supporting the `file` property |
||
| 44 | { type: 'html', subdir: 'report-html' }, |
||
| 45 | { type: 'lcovonly', subdir: '.', file: 'report-lcovonly.txt' }, |
||
| 46 | { type: 'lcov', subdir: 'report-lcov' } |
||
| 47 | ] |
||
| 48 | }, |
||
| 49 | |||
| 50 | webpack: require( './config/webpack.test.js' ), |
||
| 51 | |||
| 52 | webpackMiddleware: { |
||
| 53 | |||
| 54 | // Webpack-dev-middleware configuration |
||
| 55 | // i. e. |
||
| 56 | stats: 'errors-only' |
||
| 57 | } |
||
| 58 | } ); |
||
| 59 | }; |
||
| 60 |